import React from "react";
import "./me.scss";
import { Link } from "react-router-dom";

class me extends React.Component {
  constructor(props) {
    super(props);
    this.state = {};
  }
  nav(val) {
    console.log(val);
    this.props.history.push({ pathname: "/middle", query: val });
  }
  render() {
    return (
      <div className="me">
        {/* 路由传参 */}
        <button onClick={() => this.props.history.push("/middle")}>
          通过函数跳转
        </button>
        {/* 路由传参 */}
        <div onClick={this.nav.bind(this, "world")}>事件路由跳转</div>
        {/* 路由传参 */}
        <Link to={{ pathname: "/middle", query: "参数2" }}>link路由传参</Link>
        <br></br>
        {/* 组件 传参 */}
        <Link to={{ pathname: "/child" }}>link跳转子路由</Link>
      </div>
    );
  }
}
export default me;
